import 'package:flutter/material.dart';
import 'package:pizza_test/model/chefmodel.dart';
// 所有厨师完成的情况
class FootPizzaCurrentNum extends StatelessWidget {
  
  final List<Chef> chefs;

  const FootPizzaCurrentNum({Key key, this.chefs}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final bordersize = BorderSide(width: 1,color: Colors.grey);
    return Container(
      decoration: BoxDecoration(
        border: Border(
          left: bordersize,
          bottom: bordersize,
        )
      ),
      child: Padding(
        padding: const EdgeInsets.only(top: 10, left: 5),
        child: Column(
          children: <Widget>[
            Container(
              alignment: Alignment.bottomLeft,
              child: Text(
                "Bindo Pizza Factory Summary(Remaining Pizza to be made)", 
                style: TextStyle(fontWeight: FontWeight.bold),
              )
            ),
            SizedBox(height: 20,),
            Container(
              child: Table(
                children: [
                  TableRow(
                    children: [
                      ChefRemianNum(chef: chefs[0]),
                      ChefRemianNum(chef: chefs[1]),
                      ChefRemianNum(chef: chefs[2]),
                    ]
                  ),
                  TableRow(
                    children: [
                      ChefRemianNum(chef: chefs[3]),
                      ChefRemianNum(chef: chefs[4]),
                      ChefRemianNum(chef: chefs[5]),
                    ]
                  ),
                  TableRow(
                    children: [
                      ChefRemianNum(chef: chefs[6]),
                      Container(),
                      Container()
                    ]
                  ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}

class ChefRemianNum extends StatefulWidget {

  final Chef chef;

  const ChefRemianNum({Key key, this.chef}) : super(key: key);

  @override
  _ChefRemianNumState createState() => _ChefRemianNumState();
}

class _ChefRemianNumState extends State<ChefRemianNum> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Text("${widget.chef.name}:${widget.chef.pizzas.length}"),
    );
  }
}